package com.lhc.HomeWork;

import java.util.*;

public class StuMaster {
    private List<Student> stuLst;
    private Student stu;

    public StuMaster() {
        stuLst=new ArrayList<>();

    }

    public void init()
    {
        stu=new Student();
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入名字");
        String stuName=sc.next();
        stu.setStuName(stuName);
        double stuScore=(double)((int)(Math.random()*500+500))/10;
        stu.setStuScore(stuScore);
        stuLst.add(stu);
    }

    //按成绩排序
    public void sortByScore()
    {
           Collections.sort(stuLst);
    }

    public void printStuInfo()
    {
        for (int i=0;i<stuLst.size();i++)
        {
            System.out.println(stuLst.get(i));
        }
    }

}
